#include <QApplication>
#include <QBoxLayout>
#include "Main.h"
#include "XWavTab.h"
#include "XLpaTab.h"


XWindow::XWindow(QWidget *parent) : QWidget(parent) {
	XWavTab *wavTab = new XWavTab(this);
	XLpaTab *lpaTab = new XLpaTab(this);
	
	tabWidget = new QTabWidget();
	
	tabWidget->addTab(wavTab, "WAV");
	tabWidget->addTab(lpaTab, "LPA");
	
	QHBoxLayout *layout = new QHBoxLayout();
	layout->addWidget(tabWidget);
	this->setLayout(layout);
	
	resize(WIN_SIZE_W, WIN_SIZE_H);
	move(WIN_POS_X, WIN_POS_Y);
	setWindowTitle(WIN_TITLE);
}


int main(int argc, char *argv[]) {
	QApplication app(argc, argv);

	//*
	XWindow window;
	window.show();
	return app.exec();
	/*/
	//*
	QString fn1 = "../data/yinyue.wav";
	QString fn2 = "../data/yinyue.lpa";
	QString fn3 = "../data/yinyue-lpa.wav";
	/*/
	QString fn1 = "../data/1874.wav";
	QString fn2 = "../data/1874.lpa";
	QString fn3 = "../data/1874-lpa.wav";
	//*/

	XWav *wav = new XWav();
	wav->update(fn1);
	wav->setParameters(400, 50);
	wav->show();
	wav->move(WIN_POS_X, WIN_POS_Y);
	wav->convert(fn2);
	wav->close();

	XLpa *lpa = new XLpa();
	lpa->update(fn2);
	lpa->show();
	lpa->move(WIN_POS_X, WIN_POS_Y);
	lpa->convert(fn3);
	lpa->close();

	return 0;
	//*/
}
